home *** CD-ROM | disk | FTP | other *** search
- /* text.h */
-
- /* some message port things */
- #define REPLYPORT(a) ((a)->mn_ReplyPort)
- #define TMREPLYPORT(a) (REPLYPORT(&((a)->Msg)))
-
- /* string length... if -1 check for where the null termination is */
- #define STRLEN(a) ((((a)->StrLen==-1)?strlen((a)->String):(a)->StrLen))
- #define STR(a) (a->String)
-
-
- /* Messages sent/received are in this format */
- /* Usually for text but may send other things if U like */
-
- struct String0 {
- char *String; /* pointer to memory of string */
- long StrLen; /* actual string length (or -1 for NULL termination) */
- long FreeLen; /* If string is to be freed, how much mem was alloc'd */
- };
- /*
- the receiver should do the following:
- if(FreeLen > 0) FreeMem(String, FreeLen);
- when finished with the string
- */
-
- struct TextMessage {
- struct Message Msg;
- long Command; /* What should we do?? */
- struct String0 String;
- struct String0 RepString;
- long Args[8]; /* 8 arguments */
- void *Extra; /* expandable! */
-
- };
-
- /* Currently defined commands (default) */
- #define TM_TEXT 't' /* ordinary text.. send it or whateever */
- #define TM_EXIT 'q' /* tell receiver to die */
- #define TM_SETWIDTH 'w' /* set window width */
- #define TM_SETHEIGHT 'l' /* Set window height */
- #define TM_HELP 'h' /* ask receiver known command */
- #define TM_COMMAND 'c' /* Send a command to receiver */
-
- /*
- When replying totextmessages the receiver should either use the supplied
- SafeReplyTextMessage(message), where message is a pointer to the sent
- message
- or other wise perform the following steps:
- SafeFreeString0(&(msg->String)); which sets that pointer to NULL also
- if(TMREPLYPORT(msg))
- ReplyMsg((struct Message *)msg);
- else FreeMem(msg, sizeof(struct TextMessage));
-
- this means that if the sender does not want thestring or the message freed
- then it should have areply port for it to be returned.
- */
-
-